package cn.zyq.ykb.controller.tk;

import org.springframework.security.access.prepost.PreAuthorize;
import cn.zyq.ykb.system.ry.util.poi.ExcelUtil;
import cn.zyq.ykb.system.common.BaseController;
import cn.zyq.ykb.system.annotation.Log;
import cn.zyq.ykb.system.ry.enums.BusinessType;
import cn.zyq.ykb.beans.tk.MenuCollect;
import cn.zyq.ykb.service.tk.MenuCollectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import cn.zyq.ykb.system.common.BaseController;
import cn.zyq.ykb.system.common.PageParam;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 菜单收藏Controller
 *
 * @author SystemAuth
 * @date 2023-10-20
 */

@RestController(value = "MgtMenuCollectController")
@RequestMapping("/api/menuCollect")
@Api(tags = "菜单收藏接口")
public class MenuCollectController extends BaseController {

    @Autowired
    private MenuCollectService menuCollectService;

    /**
     * 查询菜单收藏列表
     */
    @ApiOperation(value = "列表", response = MenuCollect.class)
    @PostMapping("/list")
    public Object list(@RequestBody PageParam pageParam) {
        return this.menuCollectService.selectMenuCollectList(pageParam);
    }


    /**
     * 获取菜单收藏详细信息
     */
    @ApiOperation(value = "详情", response = MenuCollect.class)
    @GetMapping(value = "/{menuCollectID}")
    public Object getInfo(@PathVariable("menuCollectID") Integer menuCollectID) {
        return this.menuCollectService.selectMenuCollectByMenuCollectID(menuCollectID);
    }

    /**
     * 新增菜单收藏
     */
    @ApiOperation(value = "新增")
    @Log(title = "菜单收藏", businessType = BusinessType.INSERT)
    @PostMapping
    public Object add(@RequestBody MenuCollect menuCollect) {
        return this.menuCollectService.insertMenuCollect(menuCollect);
    }

}
